Skip to content

P2841R7 Concept and variable-template template-parameters #7690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 15, 2025

Conversation

burblebee
Copy link
Contributor

@burblebee burblebee commented Feb 17, 2025

[temp.param], [temp.arg.type] Some instructions do not apply due to more recent changes in the wording.
[temp.param] Added a reference for concept-dependent to where it's defined. [temp.constr.concept] Replace "may" with "might" inside note.

Fixes #7657.
Also fixes cplusplus/papers#1546

Notes:

  • I had several issues with some of the wording - see embedded FIXMEs.
  • It wasn't clear whether \tcode or math font should be used when formatting some of the invented variables as both appear to be used inconsistently.

@burblebee burblebee marked this pull request as ready for review February 17, 2025 17:16
@jensmaurer jensmaurer added this to the post-2025-02 milestone Feb 18, 2025
can be the product of replacing a
\tcode{>>} token by two consecutive \tcode{>}
tokens\iref{temp.names}.
\end{note}

\pnum
%FIXME: "is" or "shall be"? i.e., what if it's not?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is. It's a close set. I do agree we never seem to define template parameter, this might be the right place to do it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you send a separate pull request to create such a definition?

a \grammarterm{template-name} for a template template parameter pack
\end{itemize}
designating the $i^\text{th}$ corresponding
type, template, or constant template argument;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ordering of the bulleted list is "constant, type, template" but this part follows it up with "type, template, constant". Neither is consistent with the "type, constant, template" ordering that seems to be preferred elsewhere in the text.

\item if they declare template template parameters,
%FIXME: What are "their kinds"? And what does it mean for kinds to be the same?
%FIXME: We refer to "kinds" in [temp.param]/p2 but never define it.
their kinds are the same and their \grammarterm{template-head}{s} are equivalent.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is redundant with the first item on this list:

Suggested change
their kinds are the same and their \grammarterm{template-head}{s} are equivalent.
their \grammarterm{template-head}{s} are equivalent.

Also, the grammar for concept-tt-parameter does not include a template-head, instead we have "template < template-parameter-list >". The only difference between the two is the optional requires-clause, which (for concept template parameters) would be disallowed by [temp.param]/4 anyway, so we should probably just use "template-head".

\tcode{TT},
\tcode{TT} denoting a class template or an alias template,
a template template argument
\tcode{VV} denoting a variable template or a concept,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another instance of inconsistent ordering: here it's "T, TT, VV, i" but subsequent text uses "T, i, TT, VV".

lprv
lprv previously requested changes Feb 21, 2025
each appearance of \tcode{C}{'s} template parameters in
the parameter mappings of the atomic constraints
(including concept-dependent constraints)
in \tcode{CI$'$}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't make sense to me. Per the previous paragraph, CI' is the normal form of a concept-id whose concept is C, so its parameter mappings shouldn't include any template parameters of C (see [temp.constr.normal]/1.4).

The constraint is satisfied if \tcode{CI$''$} is satisfied.
\begin{note}
Checking whether \tcode{CI$''$} is satisfied
can lead to further normalization of concept-dependent constraints.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
can lead to further normalization of concept-dependent constraints.
can lead to further satisfaction checking of concept-dependent constraints.

template <typename T, template<typename> concept CC>
concept D = CC<T>;

template<typename T,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
template<typename T,
template<typename U,

This example deals with parameter mappings of atomic constraints, so using distinct names for template parameters seems preferable.

template<typename T,
template<typename> concept CT,
template<typename, template<typename> concept> concept CU>
int f() requires CU<T, CT>;
Copy link
Contributor

@lprv lprv Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int f() requires CU<T, CT>;
int f() requires CU<U, CT>;

(matching change for the above suggestion)

void g() requires CC<U*, C>;
\end{codeblock}
The normal form of the associated constraints of \tcode{f} is
the concept-dependent constraint \tcode{CT<T, C>}.\\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the concept-dependent constraint \tcode{CT<T, C>}.\\
the concept-dependent constraint \tcode{CT<U*, C>}.\\

\end{codeblock}
The normal form of the associated constraints of \tcode{f} is
the concept-dependent constraint \tcode{CT<T, C>}.\\
The normal form of the associated constraints of \tcode{g} is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The normal form of the associated constraints of \tcode{g} is
The the associated constraints of \tcode{g} are

template<template<typename T> concept X, typename T>
int f(S<X, T>) requires X<T> { return 43; } // \#2

f(S<A, int>{}); // ok, select \#1 because \#2 is not eligible for subsumption
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "#1" and not "ambiguous"?

A synthesized template has the same \grammarterm{template-head} as
its corresponding template template parameter.

\pnum
\begin{note}
Copy link
Contributor

@lprv lprv Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note pertains to p3 but these changes place it at the very start of p5, which seems a bit odd.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The paper unfortunately gives rather insufficient editing context. @cor3ntin Please indicate more clearly where new paragraphs are intended to be created. As it is, the fate of the original note is unclear.

@burblebee
Copy link
Contributor Author

@lprv Thanks for your excellent review! I applied some of your suggestions (and might be able to apply a couple more), but several of them are beyond simple editorial fixes, hence outside the scope of applying this motion. Please open issues for these!

@tkoeppe tkoeppe force-pushed the motions-2025-02-cwg-7 branch 2 times, most recently from 3722ca4 to 745fbf7 Compare March 14, 2025 17:22
burblebee and others added 4 commits March 15, 2025 00:51
Editorial notes:
* [temp.param]temp.arg.type] Some instructions do not apply
  due to more recent changes in the wording.
* [temp.param] Added a reference for concept-dependent to where it's defined.
* [temp.param] Move reference after "concept-dependent constraint".
* [temp.constr.concept] Replace "may" with "might" inside note.
* [temp.constr.concept] Add a reference for "normal form".
* [temp.func.order] Move note to remain with the relevant context.
This fixes an oversight in the paper.
@tkoeppe tkoeppe force-pushed the motions-2025-02-cwg-7 branch from 11eabe9 to 1749957 Compare March 15, 2025 00:53
@tkoeppe tkoeppe dismissed lprv’s stale review March 15, 2025 00:55

Thanks for the suggestions. We've applied a few of them, but for matters that are mostly personal preference, please file a separate editorial pull request later.

@tkoeppe tkoeppe merged commit bb3d30f into main Mar 15, 2025
2 checks passed
@jensmaurer jensmaurer deleted the motions-2025-02-cwg-7 branch June 21, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[2025-02 CWG Motion 7] P2841R7 Concept and variable-template template-parameters P2841 R7 Concept and variable-template template-parameters
5 participants